const {
    struct,
    u8,
    u16,
    seq,
    publicKey,
    u64,
  } = require("./layout-base");

const JITO_VAULT_LAYOUT = struct([
    seq(u8(), 8, "discriminator"),
    publicKey("base"),
    publicKey("vrtMint"),
    publicKey("supportedMint"),
    u64("vrtSupply"),
    u64("tokensDeposited"),
    u64("depositCapacity"),
    struct([
      u64("stakedAmount"),
      u64("enqueuedForCooldownAmount"),
      u64("coolingDownAmount"),
      seq(u8(), 256, "reserved"),
    ]),
    u64("additionalAssetsNeedUnstaking"),
    u64("vrtEnqueuedForCooldownAmount"),
    u64("vrtCoolingDownAmount"),
    u64("vrtReadyToClaimAmount"),
    publicKey("admin"),
    publicKey("delegationAdmin"),
    publicKey("operatorAdmin"),
    publicKey("ncnAdmin"),
    publicKey("slasherAdmin"),
    publicKey("capacityAdmin"),
    publicKey("feeAdmin"),
    publicKey("delegateAssetAdmin"),
    publicKey("feeWallet"),
    publicKey("mintBurnAdmin"),
    publicKey("metadataAdmin"),
    u64("vaultIndex"),
    u64("ncnCount"),
    u64("operatorCount"),
    u64("slasherCount"),
    u64("lastFeeChangeSlot"),
    u64("lastFullStateUpdateSlot"),
    u16("depositFeeBps"),
    u16("withdrawalFeeBps"),
    u16("nextWithdrawalFeeBps"),
    u16("rewardFeeBps"),
    u16("programFeeBps"),
    u8("bump"),
    u8("isPaused"),
    u64("lastStartStateUpdateSlot"),
    seq(u8(), 251, "reserved"),
]);

const VAULT_OPERATOR_DELEGATION_LAYOUT = struct([
    seq(u8(), 8, "discriminator"),
    publicKey("vault"),
    publicKey("operator"),
    struct([
        u64("stakedAmount"),
        u64("enqueuedForCooldownAmount"),
        u64("coolingDownAmount"),
        seq(u8(), 256, "reserved"),
    ], "delegationState"),
    seq(u8(), 256, "reserved"),
]);

module.exports = {
  JITO_VAULT_LAYOUT,
  VAULT_OPERATOR_DELEGATION_LAYOUT,
}